﻿using MediatR;
using SystemLYH.API.Application.Command.QualityCommand;
using SystemLYH.Domain;
using SystemLYH.Infrstructre.Interface;

namespace SystemLYH.API.Application.Handlers.QualityHandlers
{
    public class QualityUpdateHandlers : IRequestHandler<QualityUpdateCommand, int>
    {
        protected readonly IQualityRepository _qualityRepository;
        /// <summary>
        /// 库位构造函数
        /// </summary>
        /// <param name="qualityRepository"></param>
        public QualityUpdateHandlers(IQualityRepository qualityRepository)
        {
            _qualityRepository = qualityRepository;
        }
        public async Task<int> Handle(QualityUpdateCommand request, CancellationToken cancellationToken)
        {
            return await _qualityRepository.CreaseAsync(new Qualityduring()
            {
                QualityId = request.QualityId,
                QualityNumber = request.QualityNumber,
                QualityName = request.QualityName,
                SupplierID = request.SupplierID,
                finishedProductNumber = request.finishedProductNumber,
                finishedProductName = request.finishedProductName,
                finishedProductModel = request.finishedProductModel,
                BomNumbering = request.BomNumbering,
                finishedSize = request.finishedSize,
                finishedBatch = request.finishedBatch,
                productionlineNumber = request.productionlineNumber,
                productionlineName = request.productionlineName,
                CraftManageNumber = request.CraftManageNumber,
                CraftManageName = request.CraftManageName,
                ProcessNumber = request.ProcessNumber,
                ProcessName = request.ProcessName,
                Qualityquantity = request.Qualityquantity,
                Qualified = request.Qualified,
                UnQualified = request.UnQualified,
                QualityResults = request.QualityResults,
                AddName = request.AddName,
                AddTime = request.AddTime,
            });
        }
    }
}
